var Slider = function(opts){
    if(!opts.dom){
        alert("请设置轮播对象！！")
    }
    if(!opts.data|| !opts.data.length){
        alert("请设置轮播内容！！")
    }
    this.opts = opts;
    //判断对象类型如果不是jq类型转化为jq类型
    var type = this.opts.dom instanceof jQuery;
    if(!type){
        this.opts.dom = $(this.opts.dom);
    }
    this.init();//轮播初始化函数
    //this.play();//轮播自动运行函数
}
Slider.prototype = {
    init:function(){
        this.elem = "#"+this.opts.dom[0].id;//读取dom的id
        this.oBox = document.querySelector(this.elem);
        this._width = this.opts.dom[0].clientWidth;
        //判断对象是不是数组对象如果不是数组对象设置为数组对象
        if((this.opts.data)instanceof Array&&this.opts.data)this.sliderImgList=this.opts.data;
        else {
            alert("对象为非数组对象");
            this.sliderImgList = [];
        };
        var defaults = this.opts.defaults || {};
        //定义轮播初始参
        this.defaults = {
            startIndex: 0,//初始位置
            loop: false,//是否循环
            smallBtn: false,//是否有底部小圆点
            number: false,//是否有数字显示
            laseMoveFn: false,//最后滑块左拉执行函数
            location: false,
            preDef: "lnr",
            autoPlay: true,//是否自动轮播
            autoHeight: true,//高度是否自动调节
            preFn: null,
            lastImgSlider: false,//最后一张图片是否是滑块
            playTime: 6000,//轮播时间间隔
            callback: null,//回调函数
            fullScreen:false,//是否充满父类
            verticalCenter: false,//是否垂直居中
            total: 0//轮播数量
        };
        $.extend(this.defaults,defaults);//继承外部自定义类
        this.now = this.defaults.startIndex;//当前位置
        this.sliderHtml();
        this.oUl = document.getElementById('slider_touch');
        this.touch_id = $('#slider_touch');
        this.aLi = this.touch_id.find("li");//获取所有li对象
        this.initBtn();//轮播圆点初始化
        this.liInit();//轮播li初始化
        this.bind();//轮播绑定事件
        //数组小于二隐藏圆点/数字，取消轮播
        if (this.aLi.length < 2) {
            if (this.defaults.smallBtn) {
                this.oSmallBtn.style.display = "none"
            }
            if (this.defaults.number) {
                this.pageNub.style.display = "none"
            }
            this.defaults.autoPlay = false;//自动轮播为false
            this.defaults.loop = false;//循环为false
        }
        if (this.defaults.autoPlay) {
            this.pause();//清除定时器
            this.play();//启动定时器
        }
    },
    sliderHtml:function(){
        var self = this;
        var imgList = self.sliderImgList;
        var slider_ul ='';
        //设置html内容
        slider_ul+=('<ul  id="slider_touch" class="new-slide" >');
        for(var i=0;i<imgList.length;i++){
            slider_ul+=('<li class="slide-li"><a  class="J_ping"  href=""><img  alt=""    src="'+imgList[i].imgSrc+'" /></a></li>')
        }
        slider_ul+=("</ul>");
        self.opts.dom.append(slider_ul);
    },
    liInit:function(){
        var oUl = this.oUl,aLi = this.aLi,aLt_len=aLi.length,li_width = this.aLi[0].offsetWidth, li_height = this.aLi[0].offsetHeight,Box_width = this.oBox.offsetWidth,now = this.now, offsetW = 320,self=this;
        //初始化样式让li自适应图片样式
        for (var i = 0; i < aLt_len; i++) {
            $(aLi[i]).css({WebkitTransition: "all 0ms ease", transition: "all 0ms ease", height: "auto"})
        }
        //设置轮播样式
        if (this.defaults.fullScreen) {
            oUl.style.width = Box_width * aLt_len + "px";
            if (this.defaults.autoHeight) {
                offsetW = this.oBox.offsetWidth;
                if (offsetW >= 1366) {
                    offsetW = 1366
                }
                for (var i = 0; i < aLt_len; i++) {
                    aLi[i].style.width = offsetW + "px"
                }
                var hasImage = aLi[0].getElementsByTagName("img")[0];
                if (hasImage) {
                    var image = new Image();
                    image.onload = function () {
                        //设置ul高度和轮播Box高度
                        self.oBox.style.height = aLi[0].offsetHeight + "px";
                        self.oUl.style.height = aLi[0].offsetHeight + "px";
                        //if (self.defaults.verticalCenter) {
                        //    if (self.oBox.style.height.replace("px", "") >= document.documentElement.clientHeight) {
                        //        self.oBox.parentNode.style.top = "50px";
                        //        self.oBox.parentNode.style.marginTop = 0
                        //    } else {
                        //        self.oBox.parentNode.style.top = "50%";
                        //        self.oBox.parentNode.style.marginTop = "-50%"
                        //    }
                        //}
                        for (var j = 0; j < aLt_len; j++) {
                            //设置li高度
                            aLi[j].style.height = aLi[0].offsetHeight + "px"
                        }
                    };
                    image.src = hasImage.src
                } else {
                    this.oBox.style.height = aLi[0].offsetHeight + "px"
                }
            }
        } else {
            //非充满轮播Box的轮播样式
            offsetW = this.oBox.offsetWidth;
            if (offsetW >= 1366) {
                offsetW = 1366
            }
            li_width = (offsetW / 320) * 225;//设置宽度占比
            li_height = (offsetW / 320) * 150;//设置高度占比
            for (var j = 0; j < aLt_len; j++) {
                aLi[j].style.width = li_width + "px";
                aLi[j].style.height = li_height + "px"
            }
            oUl.style.width = li_width * aLt_len + "px";
            this.oBox.style.height = li_height + "px";
            this.oUl.style.height = li_height + "px";
            aLi[0].style.padding = "0";
            Box_width = li_width
        }
        //循环样式
        if (this.defaults.loop) {
            for (var i = 0; i < aLt_len; i++) {
                aLi.eq(i).css({position: "absolute", left: 0, top: 0})
                if (i == this.getNow(now, aLt_len)) {
                    aLi.eq(i).css({
                        WebkitTransform: "translate3d(" + 0 + "px, 0px, 0px)",
                        transform: "translate3d(" + 0 + "px, 0px, 0px)",
                        zIndex: 10
                    })
                } else {
                    if (i == this.getPre(now, aLt_len)) {
                        aLi.eq(i).css({
                            WebkitTransform: "translate3d(" + -Box_width + "px, 0px, 0px)",
                            transform: "translate3d(" + -Box_width + "px, 0px, 0px)",
                            zIndex: 10
                        })
                    } else {
                        if (i == this.getNext(now, aLt_len)) {
                            aLi.eq(i).css({
                                WebkitTransform: "translate3d(" + Box_width + "px, 0px, 0px)",
                                transform: "translate3d(" + Box_width + "px, 0px, 0px)",
                                zIndex: 10
                            })
                        } else {
                            if (i == this.getNextNew(now, aLt_len)) {
                                aLi.eq(i).css({
                                    WebkitTransform: "translate3d(" + Box_width * 2 + "px, 0px, 0px)",
                                    transform: "translate3d(" + Box_width * 2 + "px, 0px, 0px)",
                                    zIndex: 10
                                })
                            } else {
                                aLi.eq(i).css({
                                    WebkitTransform: "translate3d(" + -Box_width + "px, 0px, 0px)",
                                    transform: "translate3d(" + -Box_width + "px, 0px, 0px)",
                                    zIndex: 9
                                })
                            }
                        }
                    }
                }
            }
        } else {
            for (var i = 0; i < aLt_len; i++) {
                aLi.eq(i).css({
                    WebkitTransform: "translate3d(" + now * -Box_width + "px, 0px, 0px)",
                    transform: "translate3d(" + now * -Box_width + "px, 0px, 0px)"
                })
            }
        }
    }, initBtn: function () {
        //if (this.defaults.callback) {
        //    this.defaults.callback(1)
        //}
        if (this.defaults.smallBtn) {
            var slider_dot ='';
            slider_dot+=('<div class="focus-btn"  data-small-btn="smallbtn">');
            for(var i=0;i<this.aLi.length;i++){
                slider_dot+=('<span data-ol-btn="btn"></span>');
            }
            slider_dot+=('</div>');
            this.opts.dom.append(slider_dot);
            this.oSmallBtn = document.querySelector(this.elem + ' [data-small-btn="smallbtn"]');
            //获取[data-small-btn="smallbtn"]第一个对象
            this.btns = document.querySelectorAll(this.elem + ' [data-ol-btn="btn"]');
            for (var c = 0; c < this.btns.length; c++) {
                this.btns[c].className = ""
            }
            this.btns[this.getNow(this.now, this.aLi.length)].className = "active"
        }
        this.defaults.total = this.aLi.length;
        if (this.aLi.length == 2 || this.aLi.length == 3) {
            if (this.defaults.loop) {
                this.touch_id.append(this.touch_id.prop("innerHTML"))
            }
            this.aLi = this.touch_id.find("li");
            this.need = true
        }
    },bind: function () {
        var box = this.oBox, Evt = this._device();
        //判断是否可执行touch操作
        if (!Evt.hasTouch) {
            box.style.cursor = "pointer";
            box.ondragstart = function (g) {
                if (g) {
                    return false
                }
                return true
            }
        }
        var  onorientationchange= "onorientationchange" in window;
        var change = onorientationchange ? "orientationchange" : "resize";
        window.addEventListener(change, this);
        //数组长度小于二取消绑定轮播
        if (this.aLi.length < 2) {
            if (this.defaults.smallBtn) {
                this.oSmallBtn.style.display = "none"
            }
            if (this.defaults.number) {
                this.pageNub.style.display = "none"
            }
            return
        }
        box.addEventListener(Evt.startEvt, this);//绑定touchStart事件
        window.addEventListener("touchcancel", this);//绑定touchcancel事件
        //判断如果是百度浏览器添加不同事件
        if (navigator.userAgent.indexOf("baidubrowser") != -1) {
            window.addEventListener("focusin", this);
            window.addEventListener("focusout", this)
        } else {
            window.addEventListener("blur", this);
            window.addEventListener("focus", this)
        }
    },_device: function () {
        //对象绑定相应的点击事件
        var Touch = !!("ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch);
        var touchStart = "touchstart";
        var touchMove = "touchmove";
        var touchEnd = "touchend";
        return {hasTouch: Touch, startEvt: touchStart, moveEvt: touchMove, endEvt: touchEnd}
    }, handleEvent: function (d) {
        var Evt = this._device(), e = this.oBox;
        //根据事件类型来执行不同操作
        switch (d.type) {
            //
            case Evt.startEvt:
                //touchStart执行事件取消定时器执行touchStart事件
                if (this.defaults.autoPlay) {
                    this.pause();
                }
                this.startHandler(d);
                break;
            case Evt.moveEvt:
                //touchMove执行事件取消定时器执行touchMove事件
                if (this.defaults.autoPlay) {
                    this.pause()
                }
                this.moveHandler(d);
                break;
            case Evt.endEvt:
                //touchEnd执行事件取消定时器、启动定时器执行touchEnd事件
                if (this.defaults.autoPlay) {
                    this.pause();
                    this.play()
                }
                this.endHandler(d);
                break;
            case"touchcancel":
                //touchCancel执行事件取消定时器、启动定时器执行touchEnd事件
                if (this.defaults.autoPlay) {
                    this.pause();
                    this.play()
                }
                this.endHandler(d);
                break;
            case"orientationchange":
                //屏幕旋转事件、应用于手机，重新调用样式函数
                this.orientationchangeHandler();
                break;
            case"resize":
                //屏幕变化事件、应用于手机，重新调用样式函数
                this.orientationchangeHandler();
                break;
            case"focus":
                //屏幕聚焦事件、应用于电脑，清除定时器、启动定时器
                if (this.defaults.autoPlay) {
                    this.pause();
                    this.play();
                }
                break;
            case"blur":
                //屏幕失去事件、应用于电脑，清除定时器
                if (this.defaults.autoPlay) {
                    this.pause()
                }
                break;
            //百度浏览器下情况
            case"focusin":
                if (this.defaults.autoPlay) {
                    this.pause();
                    this.play()
                }
                break;
            case"focusout":
                if (this.defaults.autoPlay) {
                    this.pause()
                }
                break
        }
    }, startHandler: function (e) {
        //touchStart事件
        this.on0ff = true;
        var Evt = this._device(), hasTouch = Evt.hasTouch, oBox = this.oBox, now = this.now, aLi = this.aLi;
        //touchStart事件开始给对象绑定touchMove、touchEnd事件
        oBox.addEventListener(Evt.moveEvt, this);
        oBox.addEventListener(Evt.endEvt, this);
        this.downTime = Date.now();
        this.downX = hasTouch ? e.targetTouches[0].pageX : e.clientX - oBox.offsetLeft;//适配
        this.downY = hasTouch ? e.targetTouches[0].pageY : e.clientY - oBox.offsetTop;//适配
        this.startT = this.getTranX(aLi[this.getNow(now, aLi.length)]);//返回值为translateX的值
        this.startNowT = this.getTranX(aLi[this.getNow(now, aLi.length)]);
        this.startPreT = this.getTranX(aLi[this.getPre(now, aLi.length)]);
        this.startNextT = this.getTranX(aLi[this.getNext(now, aLi.length)]);
        this.startNextN = this.getTranX(aLi[this.getNextNew(now, aLi.length)]);
        this.stopPropagation(e)//阻止事件冒泡
    }, moveHandler: function (e) {
        var oBox = this.oBox, Evt = this._device();
        if (this.on0ff) {
            var hasTouch = Evt.hasTouch;
            var pageX = hasTouch ? e.targetTouches[0].pageX : e.clientX - oBox.offsetLeft;
            var pageY = hasTouch ? e.targetTouches[0].pageY : e.clientY - oBox.offsetTop;
            var aLi = this.aLi, aLi_len = aLi.length, now = this.now, offWidth = aLi[0].offsetWidth;
            if (this.defaults.preDef == "all") {
                this.stopDefault(e);//阻止默认动作
            }
            for (var i = 0; i < aLi_len; i++) {
                $(aLi[i]).css({WebkitTransition: "all 0ms ease", transition: "all 0ms ease"})
            }
            if (Math.abs(pageX - this.downX) < Math.abs(pageY - this.downY)) {
                if (this.defaults.preDef == "tnd" && this.defaults.preDef != "all") {
                    this.stopDefault(e)//阻止默认动作
                }
            } else {
                if (Math.abs(pageX - this.downX) > 10) {
                    if (this.defaults.preDef == "lnr" && this.defaults.preDef != "all") {
                        this.stopDefault(e)//阻止默认动作
                    }
                    if (this.defaults.loop) {
                        //根据移动距离获取改变后translateX的值，取四位
                        var nowTransX = (this.startNowT + pageX - this.downX).toFixed(4);
                        var preTransX = (this.startPreT + pageX - this.downX).toFixed(4);
                        var nextTransX = (this.startNextT + pageX - this.downX).toFixed(4);
                        var nextNTransX = (this.startNextN + pageX - this.downX).toFixed(4);
                        //move()返回样式
                        this.move(aLi[this.getNow(now, aLi_len)], nowTransX, 10, this.defaults.fullScreen);
                        this.move(aLi[this.getPre(now, aLi_len)], preTransX, 10, this.defaults.fullScreen);
                        this.move(aLi[this.getNext(now, aLi_len)], nextTransX, 10, this.defaults.fullScreen);
                        this.move(aLi[this.getNextNew(now, aLi_len)], nextNTransX, 10, this.defaults.fullScreen)
                    } else {
                        var nowTransX = this.getTranX(aLi[now]);
                        //不循环轮播到达第一个滑块往右拉执行的函数
                        if (nowTransX > 0) {
                            var speed = ((this.startT + pageX - this.downX) / 3).toFixed(4);
                            for (var j = 0; j < aLi_len; j++) {
                                this.move(aLi[j], speed)
                            }
                        }
                        //不循环轮播到达最后一个滑块往左拉执行的函数
                        else {
                            if (Math.abs(nowTransX) >= Math.abs((aLi_len - 1) * offWidth)) {
                                var translateX = (this.startT + (pageX - this.downX) / 3).toFixed(4);
                                for (var j = 0; j < aLi_len; j++) {
                                    this.move(aLi[j], translateX)
                                }
                                //最后一个滑块向左拉执行函数应用于商品详情页面图片介绍
                                if (this.defaults.laseMoveFn && typeof this.defaults.laseMoveFn == "function") {
                                    var speed = (translateX - this.startT).toFixed(4);
                                    this.defaults.laseMoveFn(speed)
                                }
                            } else {
                                var translateX = (this.startT + pageX - this.downX).toFixed(4);
                                for (var j = 0; j < aLi_len; j++) {
                                    this.move(aLi[j], translateX)
                                }
                            }
                        }
                    }
                }
            }
        } else {
            oBox.removeEventListener(e.moveEvt, this);
            oBox.removeEventListener(e.endEvt, this)
        }
        this.stopPropagation(e)//阻止事件冒泡
    }, endHandler: function (i) {
        i.stopPropagation();
        this.on0ff = false;
        var date = Date.now(), Evt = this._device(), hasTouch = Evt.hasTouch, oBox = this.oBox, pageX = hasTouch ? i.changedTouches[0].pageX : i.clientX - oBox.offsetLeft, pageY = hasTouch ? i.changedTouches[0].pageY : i.clientY - oBox.offsetTop, aLi = this.aLi, offWidth = aLi[0].offsetWidth, TranX = this.getTranX(aLi[this.getNow(this.now, aLi.length)]);
        if (pageX - this.downX < 30 && pageX - this.downX >= 0 && Math.abs(pageY - this.downY) < 30) {
            this.tab(TranX, "+=");
            return "click"
        } else {
            if (pageX - this.downX > -30 && pageX - this.downX <= 0 && Math.abs(pageY - this.downY) < 30) {
                this.tab(TranX, "-=");
                return "click"
            } else {
                if (Math.abs(pageY - this.downY) - Math.abs(pageX - this.downX) > 30 && pageX - this.downX < 0) {
                    this.tab(TranX, "-=");
                    return
                }
                if (Math.abs(pageY - this.downY) - Math.abs(pageX - this.downX) > 30 && pageX - this.downX > 0) {
                    this.tab(TranX, "+=");
                    return
                }
                if (pageX < this.downX) {
                    if (this.downX - pageX > offWidth / 3 || date - this.downTime < 200) {
                        this.now++;
                        this.tab(TranX, "++");
                        return "left"
                    } else {
                        this.tab(TranX, "+=");
                        return "stay"
                    }
                } else {
                    if (pageX - this.downX > offWidth / 3 || date - this.downTime < 200) {
                        this.now--;
                        this.tab(TranX, "--");
                        return "right"
                    } else {
                        this.tab(TranX, "-=");
                        return "stay"
                    }
                }
            }
        }
        this.stopPropagation(i);
        oBox.removeEventListener(Evt.moveEvt, this);
        oBox.removeEventListener(Evt.endEvt, this)
    },tab: function (e, l, f) {
        //l为方式
        var aLi = this.aLi, aLi_len = aLi.length, aLi_width = aLi[0].offsetWidth,slider = this, now = this.now;
        //if (this.defaults.callback && (l == "++" || l == "--")) {
        //    this.defaults.callback((this.getNow(d, k) + 1) % this.defaults.total == 0 ? this.defaults.total : (this.getNow(d, k) + 1) % this.defaults.total)
        //}
        $(aLi[this.getNow(now, aLi_len)]).addClass("active").siblings().removeClass("active");
        if (this.defaults.loop) {
            if (now < 0) {
                now = aLi_len - 1;
                this.now = aLi_len - 1
            }
            for (var i = 0; i < aLi_len; i++) {
                if (i == this.getPre(now, aLi_len)) {
                    var speed;
                    switch (l) {
                        case"++":
                            speed = 300;
                            break;
                        case"--":
                            speed = 0;
                            break;
                        case"+=":
                            speed = 0;
                            break;
                        case"-=":
                            speed = 300;
                            break;
                        default:
                            break
                    }
                    $(aLi[this.getPre(now, aLi_len)]).css({
                        WebkitTransform: "translate3d(" + -aLi_width + "px, 0px, 0px)",
                        transform: "translate3d(" + -aLi_width + "px, 0px, 0px)",
                        zIndex: 10,
                        WebkitTransition: "all " + speed + "ms ease",
                        transition: "all " + speed + "ms ease"
                    });
                } else {
                    if (i == this.getNow(now, aLi_len)) {
                        $(aLi[this.getNow(now, aLi_len)]).css({
                            WebkitTransform: "translate3d(" + 0 + "px, 0px, 0px)",
                            transform: "translate3d(" + 0 + "px, 0px, 0px)",
                            zIndex: 10,
                            WebkitTransition: "all " + 300 + "ms ease",
                            transition: "all " + 300 + "ms ease"
                        });
                    } else {
                        if (i == this.getNext(now, aLi_len)) {
                            var speed = 300;
                            switch (l) {
                                case"++":
                                    speed = 0;
                                    break;
                                case"--":
                                    speed = 300;
                                    break;
                                case"+=":
                                    speed = 300;
                                    break;
                                case"-=":
                                    speed = 0;
                                    break;
                                default:
                                    break
                            }
                            $(aLi[this.getNext(now, aLi_len)]).css({
                                WebkitTransform: "translate3d(" + aLi_width + "px, 0px, 0px)",
                                transform: "translate3d(" + aLi_width + "px, 0px, 0px)",
                                zIndex: 10,
                                WebkitTransition: "all " + speed + "ms ease",
                                transition: "all " + speed + "ms ease"
                            });
                        } else {
                            if (i == this.getNextNew(now, aLi_len)) {
                                var speed;
                                switch (l) {
                                    case"++":
                                        speed = 0;
                                        break;
                                    case"--":
                                        speed = 300;
                                        break;
                                    case"+=":
                                        speed = 300;
                                        break;
                                    case"-=":
                                        speed = 0;
                                        break;
                                    default:
                                        break
                                }
                                $(aLi[this.getNextNew(now, aLi_len)]).css({
                                    WebkitTransform: "translate3d(" + aLi_width * 2 + "px, 0px, 0px)",
                                    transform: "translate3d(" + aLi_width * 2 + "px, 0px, 0px)",
                                    zIndex: 10,
                                    WebkitTransition: "all " + speed + "ms ease",
                                    transition: "all " + speed + "ms ease"
                                });
                            } else {
                                $(aLi[i]).css({
                                    WebkitTransform: "translate3d(" + aLi_width * 2 + "px, 0px, 0px)",
                                    transform: "translate3d(" + aLi_width * 2 + "px, 0px, 0px)",
                                    zIndex: 9,
                                    WebkitTransition: "all " + 0 + "ms ease",
                                    transition: "all " + 0 + "ms ease"
                                })
                            }
                        }
                    }
                }
            }
        } else {
            for (var i = 0; i < aLi_len; i++) {
                $(aLi[i]).css({WebkitTransition: "all " + 300 + "ms ease", transition: "all " + 300 + "ms ease"})
            }
            if (now <= 0) {
                now = 0;
                this.now = 0
            }
            if (now > aLi_len - 1) {
                if (f) {
                    now = 0;
                    this.now = 0
                } else {
                    now = aLi_len - 1;
                    this.now = now
                }
            }
            for (var j = 0; j < aLi_len; j++) {
                $(aLi[j]).css({
                    WebkitTransform: "translate3d(" + (-now * aLi_width) + "px, 0px, 0px)",
                    transform: "translate3d(" + (-now * aLi_width) + "px, 0px, 0px)"
                })
            }
        }
        if (this.defaults.smallBtn) {
            for (var o = 0; o < this.btns.length; o++) {
                this.btns[o].className = ""
            }
            if (this.need) {
                this.btns[this.getNow(now, aLi_len / 2)].className = "active"
            } else {
                this.btns[this.getNow(now, aLi_len)].className = "active"
            }
        }
        aLi[this.getNow(now, aLi_len)].addEventListener("webkitTransitionEnd", m, false);
        aLi[this.getNow(now, aLi_len)].addEventListener("transitionend", m, false);
        function m() {
            if (slider.defaults.location) {
                if (e < -(aLi_len - 1) * aLi_width - aLi_width / 5) {
                    if (slider.defaults.lastImgSlider && typeof slider.defaults.lastImgSlider == "function") {
                        slider.defaults.laseMoveFn(0);
                        slider.defaults.lastImgSlider()
                    }
                }
            }
            aLi[slider.getNow(slider.now, aLi_len)].removeEventListener("webkitTransitionEnd", m, false);
            aLi[slider.getNow(slider.now, aLi_len)].removeEventListener("transitionend", m, false)
        }
    },play: function () {
        //设置定时器启动定时轮播
        var self = this;
        self.timer = setInterval(function () {
            self.now++;
            self.tab(null, "++", true)
        }, this.defaults.playTime)
    },getNow: function (now, length) {
        return now % length;
        //取余等于长度返回0，重新开始
    }, getPre: function (now, length) {
        if (now % length - 1 < 0) {
            var Pre = length - 1
        } else {
            var Pre = now % length - 1
        }
        return Pre
    }, getNext: function (now, length) {
        var Next = (now + 1) % length;
        return Next
    }, getNextNew: function (now, length) {
        var NextNew = (now + 2) % length;
        return NextNew
    },pause: function () {
        var c = this;
        clearInterval(c.timer)
    }, orientationchangeHandler: function () {
        var c = this;
        setTimeout(function () {
            c.liInit()
        }, 200)
    }, show: function () {
        this.oBox.style.display = "inline-block"
    }, hide: function () {
        this.oBox.style.display = "none"
    },getTranX: function (position) {
        var translate = position.style.WebkitTransform || position.style.transform;//chrome和其他浏览器下transform的样式
        var object = translate.indexOf("translate3d(");//找到指定字符串对象
        var transX = parseInt(translate.substring(object + 12, translate.length - 13));//截取translate3d：x的值
        return transX
    }, move: function (position, TransX, zindex, fullScreen) {
        var zindex = zindex || null;
        if (zindex) {
            position.style.zIndex = zindex
        }
        $(position).css({
            WebkitTransform: "translate3d(" + TransX + "px, 0px, 0px)",
            transform: "translate3d(" + TransX + "px, 0px, 0px)"
        });
        /*if (!fullScreen) {
            var padd = parseFloat(TransX) / 100;
            if (padd > 0.8) {
         padd = 0.8
            } else {
                if (-0.8 < padd < 0) {
         padd = (-padd)
                } else {
                    if (padd <= -0.8) {
         padd = 0.8
                    }
                }
            }
            $(g).css({padding: padd + "%"})
        }*/
    }, stopDefault: function (c) {
        if (c && c.preventDefault) {
            c.preventDefault()
        } else {
            window.event.returnValue = false
        }
        return false
    }, stopPropagation: function (c) {
        if (c && c.stopPropagation) {
            c.stopPropagation()
        } else {
            c.cancelBubble = true
        }
    },
    GoToEnd:function(){

    },
}